# coding=utf-8

import turtle
text = "输入您想要绘制的图片：1.圆形2.正方形3.矩形4.三角形5.n边形"
pen = turtle.Pen()
mod = input(text)
i = None
while True:
	if mod == "1":
		try:
			turtle.circle(int(input("r = ")))
			turtle.done()
		except ValueError:
			print("你输入的不是数字.")
			continue
	elif mod == "2":
		try:
			r = int(input("r = "))
			for i in range(4):
				pen.forward(r)
				pen.right(90)
				turtle.done()
		except ValueError:
			print("你输入的不是数字.")
			continue
	elif mod == "3":
		try:
			r1 = int(input("长:"))
			r2 = int(input("宽:"))
			for i in range(2):
				pen.forward(r1)
				pen.right(90)
				pen.forward(r2)
				pen.right(90)
			turtle.done()
		except ValueError:
			print("你输入的不是数字.")
			continue
	elif mod == "4":
		try:
			r = int(input("r = "))
			for i in range(3):
				pen.forward(r)
				pen.right(60)
			turtle.done()
		except ValueError:
			print("你输入的不是数字.")
			continue
	elif mod == "5":
		try:
			r = int(input("边长："))
			bs = int(input("边数 :"))
			for i in range(bs):
				pen.forward(r)
				pen.right(int(360 / bs))
		except:
			print("你输入的不是数字.")
			continue
	else:
		print("本程序没有这个模式或者你输入的不是数字.")
			continue